package com.hongning.railway.ui.main.fragments.threesessionsandonelesson;

import android.app.Application;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.databinding.ObservableList;
import android.support.annotation.NonNull;

import com.hongning.railway.BR;
import com.hongning.railway.R;
import com.hongning.railway.data.AppRepository;
import com.hongning.railway.entity.LoginEntity;
import com.hongning.railway.entity.reqbean.ThreesessionSanDoneLessonBean;
import com.hongning.railway.ui.main.fragments.home.itemviewmodel.MineItemViewModel;
import com.hongning.railway.util.Apputils;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class ThreesessionSanDoneLessonInfoViewModel extends BaseViewModel<AppRepository> {
    public ObservableField<ThreesessionSanDoneLessonBean.DataBean> dataBean=new ObservableField<>();
    public ObservableList<ThreesessionSanDoneLessonInfoItemModel> mineItemViewModels = new ObservableArrayList<>();
    public ItemBinding<ThreesessionSanDoneLessonInfoItemModel> itemBinding = ItemBinding.of(BR.viewModel, R.layout.layout_file_item);
    public ThreesessionSanDoneLessonInfoViewModel(@NonNull Application application, AppRepository model) {
        super(application, model);
    }


    public void  setData(ThreesessionSanDoneLessonBean.DataBean mydataBean){
        dataBean.set(mydataBean);
        if (mydataBean.getAttachinfos()!=null&&!mydataBean.getAttachinfos().isEmpty())
        {
            for (ThreesessionSanDoneLessonBean.DataBean.AttachinfoBean attachinfoBean:mydataBean.getAttachinfos())
            mineItemViewModels.add(new ThreesessionSanDoneLessonInfoItemModel(ThreesessionSanDoneLessonInfoViewModel.this,attachinfoBean));
        }
    }
    /**
     * 按钮点击事件
     * @param id
     */
    public void click(int  id){
        switch (id)
        {
            case 0:
                finish();
                break;
        }
    }
}
